<include file='Public:head'/>
<include file='Public:header'/>
<link href="__STATIC__/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="__STATIC__/umeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="__STATIC__/umeditor/lang/zh-cn/zh-cn.js"></script>
    
    <div class="container" style="margin-top:60px;">
        <div class="row">
        
            <div class="span8">
                <h4>{$circle.docname}</h4>
                <ul class="myul">
                    <volist name="thesis" id="t">
                        <li>
                            <a href="{:U(GROUP_NAME . '/Circle/thesis', array('t_id' => $t['t_id']))}">{$t.t_id}</a>
                            <div>
                                {$t.content|htmlspecialchars_decode|stripslashes}
                            </div>
                            <div class="text-right">
                                <a href=""><label for="">{$t.username}</label></a>
                                <if condition="$u_id eq $t['u_id']">
                                    <a href="#modify" data-toggle="modal" onclick="modifyThesis('{$t.t_id}', '{$t.content}');">修改</a>     
                                </if>
                                
                                <label for="">{$t.createtime}</label>
                            </div>
                        </li>
                        
                    </volist>
                </ul>
            </div> 

            <div class="span4">
                <!-- <div class="row"> -->
                <div class="thumbnail">
                    <h2 class="">圈子简介</h2>
                    <p>
                        {$circle.intro}
                    </p>
                    <p>
                        <b>圈主：</b><a href="">{$user[0].username}</a>
                    </p>
                    <p><b>热度：</b>{$circle.hot}</p>
                </div>
                <!-- </div> -->
                <br>
                <div class="thumbnail">
                    <h2>成员信息</h2>
                    <table class="table">
                        <tr>
                            <td>用户名</td>
                            <!-- <td>邮箱</td> -->
                            <td>等级</td>
                            <!-- <td>贡献词条数目</td> -->
                        </tr>
                        <volist name="user" id="u">
                            <tr>
                                <td><a href="">{$u.username}</a></td>
                                <td>
                                    <if condition="$u.degree eq 1">
                                        圈主
                                    <else />
                                        普通成员
                                    </if>
                                </td>
                            </tr>
                        </volist>
                    </table>
                </div>
            </div> 
        </div>
            
    </div>
<include file='Public:footer/'>

<!-- Modal -->
<div id="modify" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">修改见解</h3>
  </div>
  <div class="modal-body">
    <form action="{:U(GROUP_NAME . '/Circle/updateThesisHandle')}" method="post" id="modifyForm">
        <input type="hidden" id="t_idModify" name="t_id">
        <div type="text/plain" id="myEditor" style="">
        </div>
        <!-- <input type="text/plain" id="myEditor"> -->
        <!-- <input type="hidden" id="contentModify" name="content"> -->
    </form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    <button class="btn btn-primary" id="Submit">Save changes</button>
  </div>
</div>

<script>
    //实例化编辑器
    var um = UM.getEditor('myEditor');
    um.addListener('blur',function(){
        $('#focush2').html('编辑器失去焦点了')
    });
    um.addListener('focus',function(){
        $('#focush2').html('')
    });

    $(function(){
        $('#Submit').click(function(){
            // var content = UM.getEditor('myEditor').getContent();
            // $("#contentModify").val(content);
            // alert(content);
            $("#modifyForm").submit();
        })
    })

    function modifyThesis(t_id, content) {
        $("#t_idModify").val(t_id);
        // $("#contentModify").val(content);
        UM.getEditor('myEditor').setContent(content);
    }


</script> 

<style>
  .myul li{
    display: block;
    width: 95%;
    border-radius: 3px;
    border: 1px dashed #ccc;
    height: auto;
    line-height: 20px;
    margin-top: 8px;
    padding:10px;
    padding-left: 8px;
    color: gray;
    font-size: 15px;
    background: #eee;
  }
</style>